﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace The_LarX
{
    public class LarRegistry : Component
    {
        public List<string> Messages = new List<string>();
        public float X = 30;
        public float Y = 30;
        public float Offset = 30;
        public int Speed = 100;
        public string Font = "Miramonte";

        public LarRegistry(GameScreen sc)
            : base(sc)
        {
        }

        public override void Update()
        {
            base.Update();
        }

        protected Color Color = Color.White;
        public override void Draw()
        {
            Engine.QueuedActions.AddQueuedAction(0, Render);
        }
        private void Render()
        {
            base.Draw();

            for (int i = 0; i < 5; i++)
            {
                if (Messages.Count > i)
                {
                    if (i == 0)
                    {
                        Color = AnimationHelper.AnimateStatic(Color, new Color(255, 255, 255, 0), Speed);
                        if (Color.A < 5)
                        {
                            Color = Color.White;
                            Messages.RemoveAt(0);
                            return;
                        }
                    }
                    Engine.RenderManager.DrawString(Messages[i], 2, Color.A, new Vector2(X + (Offset * i), Y), Font,
                        new Color(255, 255, 255, Color.A), null);
                }
            }
        }
    }
}
